﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FacultyExample
{
    class Student
    {
        public string FirstName;
        public string LastName;
        public DateTime DateOfBirth;
        public List<int> Marks = new List<int>();

        public static Random rndGenerator = new Random();
        public static int StudentCount;

        public void GenerateRandomStudentParameters()
        {
            StudentCount++;
            FirstName = "Вася";
            LastName = Student.StudentCount.ToString();
            DateOfBirth = new DateTime(Student.rndGenerator.Next(1990, 2012), Student.rndGenerator.Next(1, 13), Student.rndGenerator.Next(1, 21));
            for (int i = 0; i < 5; i++)
            {
                int mark = Student.rndGenerator.Next(1, 101);
                Marks.Add(mark);
            }
        }

        public static Student GenerateRandomStudent()
        {
            Student.StudentCount++;
            Student student = new Student();
            student.FirstName = "Вася";
            student.LastName = Student.StudentCount.ToString();
            student.DateOfBirth = new DateTime(Student.rndGenerator.Next(1990, 2012), Student.rndGenerator.Next(1, 13), Student.rndGenerator.Next(1, 21));
            for (int i = 0; i < 5; i++)
            {
                int mark = Student.rndGenerator.Next(1, 101);
                student.Marks.Add(mark);
            }
            return student;
        }

        public void PrintStudentMarksToConsole()
        {
            foreach (var mark in Marks)
            {
                Console.WriteLine(mark);
            }
        }

        public void PrintStudentInfoToConsole()
        {
            Console.WriteLine("First Name: {0}", FirstName);
            Console.WriteLine("Last Name: {0}", LastName);
            Console.WriteLine("Birthday: {0}", DateOfBirth.ToString("dd/MM/yyyy"));
        }

        public double CalculateAvgMark()
        {
            return Marks.Average();
        }

    }
}
